const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {
      studentName: "CHD会议室预约",
      studentImg: "./../../images/default.png",
      introSelf: "我就是这条街，这条街最靓的仔！"
    },
    //用户的数据
    dearUser: null
  },
  goExamined: function () {
    wx.navigateTo({
      url: "/pages/toExamined/toExamined"
    })

  },
  goUserIdentify: function () {
    wx.navigateTo({
      url: "/pages/userIdentify/userIdentify"
    })
  },
  goAddMeeting: function () {
    wx.navigateTo({
      url: "/pages/addMeeting/addMeeting"
    })
  },
  goTest: function () {
    wx.navigateTo({
      url: "/pages/allMeetingRoom/allMeetingRoom"
    })
  },
  goAllRecords: function () {
    wx.navigateTo({
      url: "/pages/allRecords/allRecords"
    })
  },
  goUserManual: function () {
    wx.navigateTo({
      url: "/pages/userManual/userManual"
    })
  },
  goAdvice: function () {
    wx.navigateTo({
      url: "/pages/myAdvice/myAdvice"
    })
  },
  goAdviceLsit: function () {
    wx.navigateTo({
      url: "/pages/admAdviceList/admAdviceList"
    })
  },


  async goMyAppointment() {
    var that = this
    wx.navigateTo({
      url: "/pages/myAppointment/myAppointment"
    })
  },


  async onLoad(options) {
    var that = this
    let checkRes = await wx.cloud.database().collection("user").where({
      _openid: app.globalData.userInfo._openid
    }).get()
    console.log(checkRes)
    let dearUser = checkRes.data[0]
    dearUser.introSelf = "我就是这条街，这条街最靓的仔！"
    console.log(dearUser)
    that.setData({
      dearUser: dearUser,
    })
  },
  async show(options) {
    var that = this
    let checkRes = await wx.cloud.database().collection("user").where({
      _openid: app.globalData.userInfo._openid
    }).get()
    console.log(checkRes)
    let dearUser = checkRes.data[0]
    dearUser.introSelf = "我就是这条街，这条街最靓的仔！"
    that.setData({
      dearUser: dearUser,
    })
  }

})